﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QLMB.Models;
using QLMB.ViewModels;
using System.Web.Script.Serialization;

namespace QLMB.Controllers
{
    public class BookController : BaseController
    {
        //public IBookTicketRepository Repository { get; set; }

        //public BookController() : this(new BookTicketRepository())
        //{
        //}

        //public BookController(IBookTicketRepository repository)
        //{
        //    Repository = repository;
        //}

        [HttpGet]
        public ActionResult GetPlaces()
        {
            InfoFlight temp = new InfoFlight();
            temp.Ngaydi = DateTime.Now.Date;
            temp.Ngayve = DateTime.Now.AddDays(1).Date;
            return View(temp);
        }

        [HttpPost]
        public ActionResult GetPlaces(InfoFlight info)
        {
            return RedirectToAction("ListFight","Book",info);
        }

        [HttpGet]
        public ActionResult ListFight(InfoFlight info, int dif = 1)
        {
            ViewBag.DSCB = Repository.LayDSChuyenBay(info.Ngaydi, info.Sanbaydi, info.Sanbayden);
            return View(info);
        }

        [HttpPost]
        public ActionResult ListFight(InfoFlight info)
        {
            return View(info);
        }


        [AcceptVerbs(HttpVerbs.Get)]
        public JsonResult GetListArriveAirport(string id)
        {
            InfoFlight temp = new InfoFlight();
            var sbden = temp.LayDSSBDen(id);
            return Json(sbden,JsonRequestBehavior.AllowGet); 
        }
        

    }
}
